#include <iostream>
#include "Expr.h"
#include "ExprCreator.h"
#include "Visitor.h"
#include "CodeDumpVisitor.h"
#include "EvalVisitor.h"
#include "Expr2CodeVisitor.h"

void TestCodeDumpVisitor(){
	ExprCreator exprcreator;
	Expr* expr = exprcreator.CreateExpr(std::cin);
	Visitor* v = new CodeDumpVisitor(std::cout);
	expr->Accept(v);
	delete v;
	delete expr;
}
void TestEvalVisitor(){
    ExprCreator exprcreator;
	Expr* expr = exprcreator.CreateExpr(std::cin);
	EvalVisitor* ev = new EvalVisitor();
	expr->Accept(ev);
	std::cout<<ev->Getvalue()<<std::endl;
	delete ev;
	delete expr;
}
void TestExpr2CodeVisitor(){
	ExprCreator exprcreator;
	Expr* expr = exprcreator.CreateExpr(std::cin);
	Expr2CodeVisitor* cv = new Expr2CodeVisitor(std::cout);
	expr->Accept(cv);
	delete cv;
	delete expr;
}
